#! /usr/bin/python

MAX = 10**6
solutions = 1975
count = 0
M = 15
rTriangles = set()
rTriangles.add((9, 12, 15))

for m in range(1, 2*M):
    for n in range(m+1, 2*M):
	a = 2*m*n
	b = n**2 - m**2
	c = m**2 + n**2
	if a > 2*M or b > 2*M: break
        if a > M and b > M: continue
	rTriangles.add((a, b, c))
	#print a, b, c

#print rTriangles
def pairs(a, b):    
    big = max(a, b)
    small = min(a, b)
    if big > M and big > 2*small: return 0
    if big < M and big > 2*small: return small/2    
    if big > M: 
	return big/2 - (big - small)+1
       
    r = big/2 - (big-small)+ 1 + small/2
    #print a, b, r
    return r
        
for (a, b, c) in rTriangles:
    r = pairs(a, b)
    count += r
    print a, b, r

print count
